package com.github.tangmonkmeat;

import java.util.Scanner;

/**
 * Description:
 *
 * @author zwl
 * @version 1.0
 * @date 2021/6/2 下午3:57
 */
public class 数字组合 {

    public static void main(String[] args) {
        System.out.println(getMin());
    }

    public static int getMin(){
        try (Scanner scanner = new Scanner(System.in)) {
            int n = scanner.nextInt();
            if (n <= 9) {
                return n;
            } else if (n > 45) {
                return -1;
            } else {
                int temp = 9;
                int i = 0;
                int res = 0;
                while (n > 0) {
                    res = temp * (int) Math.pow(10, i) + res;
                    i++;
                    n = n - temp;
                    temp = n < temp ? n : temp - 1;
                }
                return res;
            }
        }
    }
}
